import axios from 'axios'
axios.defaults.baseURL = 'http://localhost:8888/api'
// 获取商品列表
export const getGoodsList = (pageindex) => axios.get(`/getgoods?pageindex=${pageindex}`).then(res => res.data)

// 获取商品详情
export const gitGoodsInfo = (id) => axios.get(`/goods/getinfo /${id}`).then(res => res.data)

// 商品详情轮播图
export const getLunbotu = (id) => axios.get(`/getthumimages/${id}`).then(res => res.data)

// 获取商品价格及描述
export const getGoodinfo = id => axios.get(`/goods/getinfo/${id}`).then(res => res.data)

// 添加到购物车页面数据
export const getShopInfo = (id) => axios.get(`/goods/getshopcarlist/${id}`).then(res => res.data)

// then(res => res.data)  可以不用接这个，只是得到的数据多一层jjj

// 获取图片列表顶部分类
export const getImgCate = () => axios.get('/getimgcategory').then(res => res.data)

// 根据分类id获取图片列表数据
export const getImgList = (id) => axios.get(`/getimages/${id}`).then(res => res.data)

// 获取图文详情缩略图
export const getThumb = (id) => axios.get(`/getthumimages/${id}`).then(res => res.data)
// 获取缩略图描述
export const getImgInfo = (id) => axios.get(`/getimageInfo/${id}`).then(res => res.data)
// 获取评论列表
export const getComment = (id, pageindex) => axios.get(`/getcomments/${id}?pageindex=${pageindex}`).then(res => res.data)

// 发表评论
export const getAddressComment = (id, content) => axios.post(`/postcomment/${id}`, content).then(res => res.data)
